CREATE database if NOT EXISTS `ruyuan_eshop_action01` default character set utf8 collate utf8_general_ci;
use `ruyuan_eshop_action01`;

SET NAMES utf8;

SET FOREIGN_KEY_CHECKS = 0;

-- 售后服务用户收货地址信息表
DROP TABLE IF EXISTS `es_as_change`;
CREATE TABLE `es_as_change` (
                                `id` bigint(20) NOT NULL COMMENT '主键ID',
                                `service_sn` varchar(50) DEFAULT NULL COMMENT '售后服务单号',
                                `ship_name` varchar(50) DEFAULT NULL COMMENT '收货人姓名',
                                `province_id` bigint(20) DEFAULT NULL COMMENT '收货地址省份id',
                                `city_id` bigint(20) DEFAULT NULL COMMENT '收货地址城市id',
                                `county_id` bigint(20) DEFAULT NULL COMMENT '收货地址区县id',
                                `town_id` bigint(20) DEFAULT NULL COMMENT '收货地址城镇id',
                                `province` varchar(255) DEFAULT NULL COMMENT '收货地址省份名称',
                                `city` varchar(255) DEFAULT NULL COMMENT '收货地址城市名称',
                                `county` varchar(255) DEFAULT NULL COMMENT '收货地址县(区)名称',
                                `town` varchar(255) DEFAULT NULL COMMENT '收货地址城镇名称',
                                `ship_addr` varchar(255) DEFAULT NULL COMMENT '收货地址',
                                `ship_mobile` varchar(50) DEFAULT NULL COMMENT '收货人手机号',
                                PRIMARY KEY (`id`) USING BTREE,
                                KEY `ES_INDEX_ID` (`id`) USING BTREE,
                                KEY `ES_INDEX_SERVICE_SN` (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='售后服务用户收货地址信息表';

-- 售后服务用户退还商品物流信息表
DROP TABLE IF EXISTS `es_as_express`;
CREATE TABLE `es_as_express` (
                                 `id` bigint(20) NOT NULL COMMENT '主键ID',
                                 `service_sn` varchar(50) DEFAULT NULL COMMENT '售后服务单号',
                                 `courier_number` varchar(255) DEFAULT NULL COMMENT '物流单号',
                                 `courier_company_id` bigint(20) DEFAULT NULL COMMENT '物流公司id',
                                 `courier_company` varchar(255) DEFAULT NULL COMMENT '物流公司名称',
                                 `ship_time` bigint(20) DEFAULT NULL COMMENT '发货时间',
                                 PRIMARY KEY (`id`) USING BTREE,
                                 KEY `ES_INDEX_ID` (`id`) USING BTREE,
                                 KEY `ES_INDEX_SERVICE_SN` (`service_sn`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='售后服务用户退还商品物流信息表';

-- 售后服务图片信息表
DROP TABLE IF EXISTS `es_as_gallery`;
CREATE TABLE `es_as_gallery` (
                                 `id` bigint(20) NOT NULL COMMENT '主键ID',
                                 `service_sn` varchar(50) DEFAULT NULL COMMENT '售后单号',
                                 `img` varchar(255) DEFAULT NULL COMMENT '图片链接',
                                 PRIMARY KEY (`id`) USING BTREE,
                                 KEY `ES_INDEX_ID` (`id`) USING BTREE,
                                 KEY `ES_INDEX_SERVICE_SN` (`service_sn`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='售后服务图片信息表';

-- 售后服务商品信息表
DROP TABLE IF EXISTS `es_as_goods`;
CREATE TABLE `es_as_goods` (
                               `id` bigint(20) NOT NULL COMMENT '主键ID',
                               `service_sn` varchar(50) DEFAULT NULL COMMENT '售后服务单号',
                               `goods_id` bigint(20) DEFAULT NULL COMMENT '商品ID',
                               `sku_id` bigint(20) DEFAULT NULL COMMENT '商品SKUID',
                               `ship_num` int(10) DEFAULT NULL COMMENT '发货数量',
                               `price` decimal(20,2) DEFAULT NULL COMMENT '商品成交价',
                               `return_num` int(10) DEFAULT NULL COMMENT '退还数量',
                               `storage_num` int(10) DEFAULT NULL COMMENT '入库数量',
                               `goods_name` varchar(255) DEFAULT NULL COMMENT '商品名称',
                               `goods_sn` varchar(255) DEFAULT NULL COMMENT '商品编号',
                               `goods_image` varchar(255) DEFAULT NULL COMMENT '商品缩略图',
                               `spec_json` longtext COMMENT '商品规格信息',
                               PRIMARY KEY (`id`) USING BTREE,
                               KEY `ES_INDEX_ID` (`id`) USING BTREE,
                               KEY `ES_INDEX_SERVICE_SN` (`service_sn`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='售后服务商品信息表';

-- 售后服务日志记录表
DROP TABLE IF EXISTS `es_as_log`;
CREATE TABLE `es_as_log` (
                             `id` bigint(20) NOT NULL COMMENT '主键ID',
                             `sn` varchar(50) DEFAULT NULL COMMENT '售后/退款编号',
                             `log_time` bigint(20) DEFAULT NULL COMMENT '创建时间',
                             `log_detail` longtext COMMENT '详细信息',
                             `operator` varchar(255) DEFAULT NULL COMMENT '操作者',
                             PRIMARY KEY (`id`) USING BTREE,
                             KEY `ES_INDEX_ID` (`id`) USING BTREE,
                             KEY `ES_INDEX_SN` (`sn`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='售后服务日志记录表';

-- ----------------------------
-- Records of es_as_log
-- ----------------------------
BEGIN;
INSERT INTO `es_as_log` VALUES (1443158816177807362, 'AS192164881809014786', 1632910849, '申请售后服务的商品已寄出，等待商家收货。', 'buy001');
INSERT INTO `es_as_log` VALUES (1443161088068698114, 'AS192164881809014786', 1632911390, '商家已成功将申请售后服务的商品入库，请等待商家进行退款。', '儒猿技术窝');
COMMIT;

-- 售后服务单表
DROP TABLE IF EXISTS `es_as_order`;
CREATE TABLE `es_as_order` (
                               `id` bigint(20) NOT NULL COMMENT '主键ID',
                               `sn` varchar(50) DEFAULT NULL COMMENT '售后单号',
                               `order_sn` varchar(50) DEFAULT NULL COMMENT '订单编号',
                               `member_id` bigint(20) DEFAULT NULL COMMENT '用户ID',
                               `member_name` varchar(100) DEFAULT NULL COMMENT '用户名',
                               `seller_id` bigint(20) DEFAULT NULL COMMENT '商家ID',
                               `seller_name` varchar(255) DEFAULT NULL COMMENT '商家名称',
                               `create_time` bigint(20) DEFAULT NULL COMMENT '创建时间',
                               `mobile` varchar(50) DEFAULT NULL COMMENT '手机号',
                               `service_type` varchar(50) DEFAULT NULL COMMENT '售后类型 RETURN_GOODS：退货，CHANGE_GOODS：换货，SUPPLY_AGAIN_GOODS：补发货品，ORDER_CANCEL：取消订单（订单已付款且未收货之前）',
                               `service_status` varchar(50) DEFAULT NULL COMMENT '售后单状态 APPLY：待审核，PASS：审核通过，REFUSE：审核拒绝，WAIT_FOR_MANUAL：待人工处理，STOCK_IN：退货入库，REFUNDING：退款中，REFUNDFAIL：退款失败，COMPLETE：完成',
                               `reason` varchar(255) DEFAULT NULL COMMENT '申请原因',
                               `apply_vouchers` varchar(255) DEFAULT NULL COMMENT '申请凭证',
                               `problem_desc` longtext COMMENT '问题描述',
                               `goods_json` longtext COMMENT '售后商品信息json',
                               `disabled` varchar(50) DEFAULT NULL COMMENT '删除状态 DELETED：已删除 NORMAL：正常',
                               `audit_remark` varchar(255) DEFAULT NULL COMMENT '商家审核备注',
                               `stock_remark` varchar(255) DEFAULT NULL COMMENT '商家入库备注',
                               `refund_remark` varchar(255) DEFAULT NULL COMMENT '平台退款备注',
                               `close_reason` varchar(255) DEFAULT NULL COMMENT '取消原因',
                               `return_addr` varchar(500) DEFAULT NULL COMMENT '退货地址信息',
                               `new_order_sn` varchar(255) DEFAULT NULL COMMENT '新订单编号',
                               `create_channel` varchar(255) DEFAULT NULL COMMENT '售后服务单创建渠道 NORMAL：正常渠道创建，PINTUAN：拼团失败自动创建',
                               PRIMARY KEY (`id`) USING BTREE,
                               KEY `ES_INDEX_ID` (`id`) USING BTREE,
                               KEY `ES_INDEX_SN` (`sn`) USING BTREE,
                               KEY `ES_INDEX_ORDER_SN` (`order_sn`) USING BTREE,
                               KEY `ES_INDEX_SERVICE_TYPE` (`service_type`) USING BTREE,
                               KEY `ES_INDEX_SERVICE_STATUS` (`service_status`) USING BTREE,
                               KEY `ES_INDEX_MEMBER_ID` (`member_id`) USING BTREE,
                               KEY `ES_INDEX_SELLER_ID` (`seller_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='售后服务单表';

-- 售后服务退款相关信息表
DROP TABLE IF EXISTS `es_as_refund`;
CREATE TABLE `es_as_refund` (
                                `id` bigint(20) NOT NULL COMMENT '主键ID',
                                `service_sn` varchar(50) DEFAULT NULL COMMENT '售后服务单号',
                                `refund_price` decimal(20,2) DEFAULT NULL COMMENT '申请的退款金额',
                                `agree_price` decimal(20,2) DEFAULT NULL COMMENT '商家同意的退款金额',
                                `actual_price` decimal(20,2) DEFAULT NULL COMMENT '实际退款金额',
                                `refund_way` varchar(255) DEFAULT NULL COMMENT '退款方式 ORIGINAL：原路退回，OFFLINE：线下支付',
                                `account_type` varchar(255) DEFAULT NULL COMMENT '账号类型',
                                `return_account` varchar(255) DEFAULT NULL COMMENT '退款账号',
                                `bank_name` varchar(255) DEFAULT NULL COMMENT '银行名称',
                                `bank_account_number` varchar(255) DEFAULT NULL COMMENT '银行账户',
                                `bank_account_name` varchar(255) DEFAULT NULL COMMENT '银行开户名',
                                `bank_deposit_name` varchar(255) DEFAULT NULL COMMENT '开户行',
                                `pay_order_no` varchar(255) DEFAULT NULL COMMENT '订单支付方式返回的交易号',
                                `refund_time` bigint(20) DEFAULT NULL COMMENT '退款时间',
                                PRIMARY KEY (`id`) USING BTREE,
                                KEY `ES_INDEX_ID` (`id`) USING BTREE,
                                KEY `ES_INDEX_SERVICE_SN` (`service_sn`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='售后服务退款相关信息表';

-- 交易快照表
DROP TABLE IF EXISTS `es_goods_snapshot`;
CREATE TABLE `es_goods_snapshot` (
                                     `snapshot_id` bigint(20) NOT NULL COMMENT '主键',
                                     `goods_id` bigint(20) DEFAULT NULL COMMENT '商品id',
                                     `name` varchar(255) DEFAULT NULL COMMENT '商品名称',
                                     `sn` varchar(255) DEFAULT NULL COMMENT '商品编号',
                                     `brand_name` varchar(255) DEFAULT NULL COMMENT '品牌名称',
                                     `category_name` varchar(255) DEFAULT NULL COMMENT '分类名称',
                                     `goods_type` varchar(20) DEFAULT NULL COMMENT '商品类型',
                                     `weight` decimal(10,2) DEFAULT NULL COMMENT '重量',
                                     `intro` longtext COMMENT '商品详情',
                                     `mobile_intro` longtext COMMENT '商品移动端详情',
                                     `price` decimal(10,2) DEFAULT NULL COMMENT '商品价格',
                                     `cost` decimal(10,2) DEFAULT NULL COMMENT '商品成本价',
                                     `mktprice` decimal(10,2) DEFAULT NULL COMMENT '商品市场价',
                                     `have_spec` smallint(1) DEFAULT NULL COMMENT '商品是否开启规格1 开启 0 未开启',
                                     `params_json` longtext COMMENT '参数json',
                                     `img_json` longtext COMMENT '图片json',
                                     `create_time` bigint(20) DEFAULT NULL COMMENT '快照时间',
                                     `point` int(10) DEFAULT NULL COMMENT '商品使用积分',
                                     `seller_id` bigint(20) DEFAULT NULL COMMENT '所属卖家',
                                     `promotion_json` longtext COMMENT '促销json值',
                                     `coupon_json` longtext COMMENT '优惠券json值',
                                     `member_id` bigint(20) NOT NULL COMMENT '会员id',
                                     PRIMARY KEY (`snapshot_id`) USING BTREE,
                                     KEY `index_goods_snapshot` (`snapshot_id`,`goods_id`,`sn`,`goods_type`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='交易快照';

-- ----------------------------
-- Records of es_goods_snapshot
-- ----------------------------
BEGIN;
INSERT INTO `es_goods_snapshot` VALUES (1443027489599254530, 1417677439226580994, '鸿蒙手机', 'hm-01', '华为', '手机', 'NORMAL', 1.00, '<p>华为自研操作系统鸿蒙os<br></p>', '', 6550.00, 6350.00, 6233.00, 1, '[{\"params\":[{\"id\":null,\"goods_id\":null,\"param_id\":718,\"param_name\":\"型号\",\"param_value\":\"鸿蒙\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":205,\"is_index\":1,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":719,\"param_name\":\"上市时间\",\"param_value\":\"2021-07-21\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":205,\"is_index\":0,\"option_list\":[\"\"]}],\"group_name\":\"主体\",\"group_id\":205},{\"params\":[{\"id\":null,\"goods_id\":null,\"param_id\":720,\"param_name\":\"颜色\",\"param_value\":\"黑色、红色、白色\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":206,\"is_index\":0,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":721,\"param_name\":\"外形尺寸\",\"param_value\":\"1000*1000\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":206,\"is_index\":0,\"option_list\":[\"\"]}],\"group_name\":\"外观\",\"group_id\":206},{\"params\":[{\"id\":null,\"goods_id\":null,\"param_id\":722,\"param_name\":\"系统版本\",\"param_value\":\"鸿蒙\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":207,\"is_index\":0,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":723,\"param_name\":\"手机操作系统\",\"param_value\":\"鸿蒙os\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":207,\"is_index\":1,\"option_list\":[\"\"]}],\"group_name\":\"系统\",\"group_id\":207},{\"params\":[{\"id\":null,\"goods_id\":null,\"param_id\":724,\"param_name\":\"CPU型号\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":208,\"is_index\":0,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":725,\"param_name\":\"CPU频率\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":208,\"is_index\":0,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":726,\"param_name\":\"CPU核数\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":208,\"is_index\":0,\"option_list\":[\"\"]}],\"group_name\":\"CPU\",\"group_id\":208},{\"params\":[{\"id\":null,\"goods_id\":null,\"param_id\":727,\"param_name\":\"4G网络制式\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":209,\"is_index\":0,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":728,\"param_name\":\"3G网络制式\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":209,\"is_index\":0,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":729,\"param_name\":\"2G网络制式\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":209,\"is_index\":0,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":730,\"param_name\":\"待机模式\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":209,\"is_index\":0,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":731,\"param_name\":\"SIM卡尺寸\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":209,\"is_index\":0,\"option_list\":[\"\"]}],\"group_name\":\"网络\",\"group_id\":209},{\"params\":[{\"id\":null,\"goods_id\":null,\"param_id\":732,\"param_name\":\"机身内存\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":210,\"is_index\":0,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":733,\"param_name\":\"运行内存\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":210,\"is_index\":0,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":734,\"param_name\":\"存储卡类型\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":210,\"is_index\":0,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":735,\"param_name\":\"最大存储扩展\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":210,\"is_index\":0,\"option_list\":[\"\"]}],\"group_name\":\"存储\",\"group_id\":210},{\"params\":[{\"id\":null,\"goods_id\":null,\"param_id\":736,\"param_name\":\"屏幕材质\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":211,\"is_index\":0,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":737,\"param_name\":\"屏幕尺寸\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":211,\"is_index\":0,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":738,\"param_name\":\"屏幕分辨率\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":211,\"is_index\":0,\"option_list\":[\"\"]}],\"group_name\":\"屏幕\",\"group_id\":211},{\"params\":[{\"id\":null,\"goods_id\":null,\"param_id\":739,\"param_name\":\"摄像头类型\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":212,\"is_index\":0,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":740,\"param_name\":\"前摄像头\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":212,\"is_index\":0,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":741,\"param_name\":\"后摄像头\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":212,\"is_index\":0,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":742,\"param_name\":\"闪光灯类型\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":212,\"is_index\":0,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":743,\"param_name\":\"传感器类型\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":212,\"is_index\":0,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":744,\"param_name\":\"变焦模式\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":212,\"is_index\":0,\"option_list\":[\"\"]}],\"group_name\":\"拍照\",\"group_id\":212},{\"params\":[{\"id\":null,\"goods_id\":null,\"param_id\":745,\"param_name\":\"电池类型\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":213,\"is_index\":0,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":746,\"param_name\":\"无线充电\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":213,\"is_index\":0,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":747,\"param_name\":\"快充功能\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":213,\"is_index\":0,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":748,\"param_name\":\"电池更换\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":213,\"is_index\":0,\"option_list\":[\"\"]}],\"group_name\":\"电池\",\"group_id\":213},{\"params\":[{\"id\":null,\"goods_id\":null,\"param_id\":749,\"param_name\":\"蓝牙版本\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":214,\"is_index\":0,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":750,\"param_name\":\"NFC（近场通讯）\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":214,\"is_index\":0,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":751,\"param_name\":\"耳机接口\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":214,\"is_index\":0,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":752,\"param_name\":\"数据线\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":214,\"is_index\":0,\"option_list\":[\"\"]}],\"group_name\":\"接口\",\"group_id\":214},{\"params\":[{\"id\":null,\"goods_id\":null,\"param_id\":753,\"param_name\":\"重力传感器\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":215,\"is_index\":0,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":754,\"param_name\":\"光线传感器\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":215,\"is_index\":0,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":755,\"param_name\":\"距离传感器\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":215,\"is_index\":0,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":756,\"param_name\":\"陀螺仪\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":215,\"is_index\":0,\"option_list\":[\"\"]},{\"id\":null,\"goods_id\":null,\"param_id\":757,\"param_name\":\"指纹识别\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":215,\"is_index\":0,\"option_list\":[\"\"]}],\"group_name\":\"手机特性\",\"group_id\":215},{\"params\":[{\"id\":null,\"goods_id\":null,\"param_id\":758,\"param_name\":\"运营商标识\",\"param_value\":\"\",\"param_type\":1,\"options\":\"\",\"required\":0,\"group_id\":216,\"is_index\":0,\"option_list\":[\"\"]}],\"group_name\":\"其他\",\"group_id\":216}]', '[{\"img_id\":1417677440279351297,\"goods_id\":1417677439226580994,\"thumbnail\":\"http://javashop-01.oss-cn-shanghai.aliyuncs.com/javashop/goods/BEF25E136AE049D481770A703340D286.jpeg_300x300\",\"small\":\"http://javashop-01.oss-cn-shanghai.aliyuncs.com/javashop/goods/BEF25E136AE049D481770A703340D286.jpeg_400x400\",\"big\":\"http://javashop-01.oss-cn-shanghai.aliyuncs.com/javashop/goods/BEF25E136AE049D481770A703340D286.jpeg_800x800\",\"original\":\"http://javashop-01.oss-cn-shanghai.aliyuncs.com/javashop/goods/BEF25E136AE049D481770A703340D286.jpeg\",\"tiny\":null,\"isdefault\":1,\"sort\":0}]', 1632879538, NULL, 1, '[]', '[]', 2);
COMMIT;

-- 订单表
DROP TABLE IF EXISTS `es_order`;
CREATE TABLE `es_order` (
                            `order_id` bigint(20) NOT NULL COMMENT '主键ID',
                            `trade_sn` varchar(20) DEFAULT NULL COMMENT '交易编号',
                            `seller_id` bigint(20) DEFAULT NULL COMMENT '店铺ID',
                            `seller_name` varchar(255) DEFAULT NULL COMMENT '店铺名称',
                            `member_id` bigint(20) DEFAULT NULL COMMENT '会员ID',
                            `member_name` varchar(255) DEFAULT NULL COMMENT '买家账号',
                            `order_status` varchar(50) DEFAULT NULL COMMENT '订单状态',
                            `pay_status` varchar(50) DEFAULT NULL COMMENT '付款状态',
                            `ship_status` varchar(50) DEFAULT NULL COMMENT '货运状态',
                            `shipping_id` bigint(20) DEFAULT NULL COMMENT '配送方式ID',
                            `comment_status` varchar(50) DEFAULT NULL COMMENT '评论是否完成',
                            `shipping_type` varchar(255) DEFAULT NULL COMMENT '配送方式',
                            `payment_method_id` bigint(20) DEFAULT NULL COMMENT '支付方式id',
                            `payment_plugin_id` varchar(50) DEFAULT NULL COMMENT '支付插件id',
                            `payment_method_name` varchar(50) DEFAULT NULL COMMENT '支付方式名称',
                            `payment_type` varchar(50) DEFAULT NULL COMMENT '支付方式类型',
                            `payment_time` bigint(20) DEFAULT NULL COMMENT '支付时间',
                            `pay_money` decimal(20,2) DEFAULT NULL COMMENT '已支付金额',
                            `ship_name` varchar(255) DEFAULT NULL COMMENT '收货人姓名',
                            `ship_addr` varchar(255) DEFAULT NULL COMMENT '收货地址',
                            `ship_zip` varchar(20) DEFAULT NULL COMMENT '收货人邮编',
                            `ship_mobile` varchar(50) DEFAULT NULL COMMENT '收货人手机',
                            `ship_tel` varchar(50) DEFAULT NULL COMMENT '收货人电话',
                            `receive_time` varchar(50) DEFAULT NULL COMMENT '收货时间',
                            `ship_province_id` bigint(20) DEFAULT NULL COMMENT '配送地区-省份ID',
                            `ship_city_id` bigint(20) DEFAULT NULL COMMENT '配送地区-城市ID',
                            `ship_county_id` bigint(20) DEFAULT NULL COMMENT '配送地区-区(县)ID',
                            `ship_town_id` bigint(20) DEFAULT NULL COMMENT '配送街道id',
                            `ship_province` varchar(50) DEFAULT NULL COMMENT '配送地区-省份',
                            `ship_city` varchar(50) DEFAULT NULL COMMENT '配送地区-城市',
                            `ship_county` varchar(50) DEFAULT NULL COMMENT '配送地区-区(县)',
                            `ship_town` varchar(50) DEFAULT NULL COMMENT '配送街道',
                            `order_price` decimal(20,2) DEFAULT NULL COMMENT '订单总额',
                            `goods_price` decimal(20,2) DEFAULT NULL COMMENT '商品总额',
                            `shipping_price` decimal(20,2) DEFAULT NULL COMMENT '配送费用',
                            `discount_price` decimal(20,2) DEFAULT NULL COMMENT '优惠金额',
                            `disabled` int(1) DEFAULT NULL COMMENT '是否被删除',
                            `weight` decimal(20,2) DEFAULT NULL COMMENT '订单商品总重量',
                            `goods_num` int(10) DEFAULT NULL COMMENT '商品数量',
                            `remark` varchar(1000) DEFAULT NULL COMMENT '订单备注',
                            `cancel_reason` varchar(255) DEFAULT NULL COMMENT '订单取消原因',
                            `the_sign` varchar(255) DEFAULT NULL COMMENT '签收人',
                            `items_json` longtext COMMENT '货物列表json',
                            `warehouse_id` int(10) DEFAULT NULL COMMENT '发货仓库ID',
                            `need_pay_money` decimal(20,2) DEFAULT NULL COMMENT '应付金额',
                            `ship_no` varchar(255) DEFAULT NULL COMMENT '发货单号',
                            `address_id` bigint(20) DEFAULT NULL COMMENT '收货地址ID',
                            `admin_remark` int(50) DEFAULT NULL COMMENT '管理员备注',
                            `logi_id` bigint(20) DEFAULT NULL COMMENT '物流公司ID',
                            `logi_name` varchar(255) DEFAULT NULL COMMENT '物流公司名称',
                            `complete_time` bigint(20) DEFAULT NULL COMMENT '完成时间',
                            `create_time` bigint(20) DEFAULT NULL COMMENT '订单创建时间',
                            `signing_time` bigint(20) DEFAULT NULL COMMENT '签收时间',
                            `ship_time` bigint(20) DEFAULT NULL COMMENT '送货时间',
                            `pay_order_no` varchar(50) DEFAULT NULL COMMENT '支付方式返回的交易号',
                            `service_status` varchar(50) DEFAULT NULL COMMENT '售后状态',
                            `bill_status` int(10) DEFAULT NULL COMMENT '结算状态',
                            `bill_sn` varchar(50) DEFAULT NULL COMMENT '结算单号',
                            `client_type` varchar(50) DEFAULT NULL COMMENT '订单来源',
                            `sn` varchar(20) DEFAULT NULL COMMENT '订单编号',
                            `need_receipt` int(1) DEFAULT NULL COMMENT '是否需要发票',
                            `order_type` varchar(50) DEFAULT 'normal' COMMENT '订单类型',
                            `order_data` text COMMENT '订单数据',
                            `balance` decimal(20,2) DEFAULT '0.00' COMMENT '预存款抵扣金额',
                            PRIMARY KEY (`order_id`) USING BTREE,
                            KEY `ind_order_sn` (`sn`) USING BTREE,
                            KEY `ind_order_state` (`order_status`,`pay_status`,`ship_status`) USING BTREE,
                            KEY `ind_order_memberid` (`member_id`) USING BTREE,
                            KEY `ind_order_term` (`disabled`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='订单表';

-- 订单投诉表
DROP TABLE IF EXISTS `es_order_complain`;
CREATE TABLE `es_order_complain` (
                                     `complain_id` bigint(20) NOT NULL COMMENT '主键',
                                     `complain_topic` varchar(50) DEFAULT NULL COMMENT '投诉主题',
                                     `content` longtext COMMENT '投诉内容',
                                     `create_time` bigint(20) DEFAULT NULL COMMENT '投诉时间',
                                     `images` longtext COMMENT '投诉凭证图片',
                                     `status` varchar(50) DEFAULT NULL COMMENT '状态，见ComplainStatusEnum.java',
                                     `appeal_content` longtext COMMENT '商家申诉内容',
                                     `appeal_time` bigint(20) DEFAULT NULL COMMENT '商家申诉时间',
                                     `appeal_images` longtext COMMENT '商家申诉上传的图片',
                                     `order_sn` varchar(50) DEFAULT NULL COMMENT '订单号',
                                     `order_time` bigint(20) DEFAULT NULL COMMENT '下单时间',
                                     `goods_name` varchar(255) DEFAULT NULL COMMENT '商品名称',
                                     `goods_id` bigint(20) DEFAULT NULL COMMENT '商品id',
                                     `goods_price` decimal(10,2) DEFAULT NULL COMMENT '商品价格',
                                     `num` int(10) DEFAULT NULL COMMENT '购买的商品数量',
                                     `shipping_price` decimal(10,2) DEFAULT NULL COMMENT '运费',
                                     `order_price` decimal(10,2) DEFAULT NULL COMMENT '订单金额',
                                     `ship_no` varchar(50) DEFAULT NULL COMMENT '物流单号',
                                     `seller_id` bigint(20) DEFAULT NULL COMMENT '商家id',
                                     `seller_name` varchar(100) DEFAULT NULL COMMENT '商家名称',
                                     `member_id` bigint(20) DEFAULT NULL COMMENT '会员id',
                                     `member_name` varchar(100) DEFAULT NULL COMMENT '会员名称',
                                     `ship_name` varchar(50) DEFAULT NULL COMMENT '收货人',
                                     `ship_addr` varchar(255) DEFAULT NULL COMMENT '收货地址',
                                     `ship_mobile` varchar(50) DEFAULT NULL COMMENT '收货人手机',
                                     `arbitration_result` longtext COMMENT '仲裁结果',
                                     `sku_id` bigint(20) DEFAULT NULL COMMENT 'sku 主键',
                                     `goods_image` varchar(255) DEFAULT NULL COMMENT '商品图片',
                                     PRIMARY KEY (`complain_id`) USING BTREE,
                                     KEY `index_order_complain` (`complain_id`,`status`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='订单投诉表';

-- 订单投诉对话记录表
DROP TABLE IF EXISTS `es_order_complain_communication`;
CREATE TABLE `es_order_complain_communication` (
                                                   `communication_id` bigint(20) NOT NULL COMMENT '主键',
                                                   `complain_id` bigint(20) DEFAULT NULL COMMENT '投诉id',
                                                   `content` longtext COMMENT '对话内容',
                                                   `create_time` bigint(20) DEFAULT NULL COMMENT '对话时间',
                                                   `owner` varchar(50) DEFAULT NULL COMMENT '所属，买家/卖家',
                                                   `owner_name` varchar(100) DEFAULT NULL COMMENT '对话所属名称',
                                                   `owner_id` bigint(20) DEFAULT NULL COMMENT '对话所属id,卖家id/买家id',
                                                   PRIMARY KEY (`communication_id`) USING BTREE,
                                                   KEY `index_order_complain_communication` (`communication_id`,`complain_id`,`owner_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='订单投诉对话记录表';

-- 订单条目表
DROP TABLE IF EXISTS `es_order_items`;
CREATE TABLE `es_order_items` (
                                  `item_id` bigint(20) NOT NULL COMMENT '主键ID',
                                  `goods_id` bigint(20) DEFAULT NULL COMMENT '商品ID',
                                  `product_id` bigint(20) DEFAULT NULL COMMENT '货品ID',
                                  `num` int(10) DEFAULT NULL COMMENT '销售量',
                                  `ship_num` int(10) DEFAULT NULL COMMENT '发货量',
                                  `trade_sn` varchar(50) DEFAULT NULL COMMENT '交易编号',
                                  `order_sn` varchar(50) DEFAULT NULL COMMENT '订单编号',
                                  `image` varchar(255) DEFAULT NULL COMMENT '图片',
                                  `name` varchar(255) DEFAULT NULL COMMENT '商品名称',
                                  `price` decimal(20,2) DEFAULT NULL COMMENT '销售金额',
                                  `cat_id` bigint(20) DEFAULT NULL COMMENT '分类ID',
                                  `state` int(1) DEFAULT NULL COMMENT '状态',
                                  `snapshot_id` bigint(20) DEFAULT NULL COMMENT '快照id',
                                  `spec_json` varchar(1000) DEFAULT NULL COMMENT '规格json',
                                  `promotion_type` varchar(255) DEFAULT NULL COMMENT '促销类型',
                                  `promotion_id` bigint(20) DEFAULT NULL COMMENT '促销id',
                                  `refund_price` decimal(20,2) DEFAULT NULL COMMENT '订单项可退款金额',
                                  `comment_status` varchar(255) DEFAULT 'UNFINISHED' COMMENT '评论状态',
                                  PRIMARY KEY (`item_id`) USING BTREE,
                                  KEY `es_order_item` (`order_sn`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='订单条目表';

-- 订单日志表
DROP TABLE IF EXISTS `es_order_log`;
CREATE TABLE `es_order_log` (
                                `log_id` bigint(20) NOT NULL COMMENT '主键ID',
                                `order_sn` varchar(50) DEFAULT NULL COMMENT '订单编号',
                                `op_id` bigint(20) DEFAULT NULL COMMENT '操作者id',
                                `op_name` varchar(100) DEFAULT NULL COMMENT '操作者名称',
                                `message` varchar(100) DEFAULT NULL COMMENT '日志信息',
                                `op_time` bigint(20) DEFAULT NULL COMMENT '操作时间',
                                PRIMARY KEY (`log_id`) USING BTREE,
                                KEY `ind_order_log` (`order_sn`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='订单日志表';

-- 订单扩展信息表
DROP TABLE IF EXISTS `es_order_meta`;
CREATE TABLE `es_order_meta` (
                                 `meta_id` bigint(20) NOT NULL COMMENT '主键ID',
                                 `order_sn` varchar(255) DEFAULT NULL COMMENT '订单编号',
                                 `meta_key` varchar(255) DEFAULT NULL COMMENT '扩展-键',
                                 `meta_value` longtext COMMENT '扩展-值',
                                 `status` varchar(50) DEFAULT NULL COMMENT '售后状态',
                                 PRIMARY KEY (`meta_id`) USING BTREE,
                                 KEY `es_ind_orderex_metaid` (`meta_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='订单扩展信息表';

-- 订单出库状态表
DROP TABLE IF EXISTS `es_order_out_status`;
CREATE TABLE `es_order_out_status` (
                                       `out_id` bigint(20) NOT NULL COMMENT '主键',
                                       `order_sn` varchar(20) DEFAULT NULL COMMENT '订单编号',
                                       `out_type` varchar(20) DEFAULT NULL COMMENT '出库类型',
                                       `out_status` varchar(20) DEFAULT NULL COMMENT '出库状态',
                                       PRIMARY KEY (`out_id`) USING BTREE,
                                       KEY `index_order_out_status` (`out_id`,`order_sn`,`out_type`,`out_status`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='订单出库状态表';

-- 售后服务退款单表
DROP TABLE IF EXISTS `es_refund`;
CREATE TABLE `es_refund` (
                             `id` bigint(20) NOT NULL COMMENT '主键id',
                             `sn` varchar(50) DEFAULT NULL COMMENT '售后服务单号',
                             `member_id` bigint(20) DEFAULT NULL COMMENT '会员id',
                             `member_name` varchar(255) DEFAULT NULL COMMENT '会员名称',
                             `seller_id` bigint(20) DEFAULT NULL COMMENT '卖家id',
                             `seller_name` varchar(255) DEFAULT NULL COMMENT '卖家姓名',
                             `order_sn` varchar(50) DEFAULT NULL COMMENT '订单编号',
                             `refund_status` varchar(50) DEFAULT NULL COMMENT '退款单状态 APPLY：新创建，REFUNDING：退款中，REFUNDFAIL：退款失败，COMPLETE：完成',
                             `create_time` bigint(20) DEFAULT NULL COMMENT '创建时间',
                             `refund_price` decimal(20,2) DEFAULT NULL COMMENT '申请退款金额',
                             `refund_way` varchar(50) DEFAULT NULL COMMENT '退款方式 ORIGINAL：原路退回，OFFLINE：线下退款，ACCOUNT：账户退款',
                             `account_type` varchar(50) DEFAULT NULL COMMENT '退款账户类型',
                             `return_account` varchar(255) DEFAULT NULL COMMENT '退款账户',
                             `bank_name` varchar(255) DEFAULT NULL COMMENT '银行名称',
                             `bank_account_number` varchar(255) DEFAULT NULL COMMENT '银行账号',
                             `bank_account_name` varchar(255) DEFAULT NULL COMMENT '银行开户名',
                             `bank_deposit_name` varchar(255) DEFAULT NULL COMMENT '银行开户行',
                             `pay_order_no` varchar(255) DEFAULT NULL COMMENT '支付结果交易号',
                             `payment_type` varchar(50) DEFAULT NULL COMMENT '订单付款类型 ONLINE：在线支付，COD：货到付款',
                             `refund_fail_reason` varchar(255) DEFAULT NULL COMMENT '退款失败原因',
                             `refund_time` bigint(20) DEFAULT NULL COMMENT '退款时间',
                             `mobile` varchar(50) DEFAULT NULL COMMENT '手机号',
                             `agree_price` decimal(20,2) DEFAULT NULL COMMENT '商家同意的退款金额',
                             `actual_price` decimal(20,2) DEFAULT NULL COMMENT '实际退款金额',
                             `goods_json` longtext COMMENT '售后商品信息json',
                             `disabled` varchar(20) DEFAULT 'NORMAL' COMMENT '删除状态 DELETED：已删除 NORMAL：正常',
                             `create_channel` varchar(255) DEFAULT NULL COMMENT '售后服务单创建渠道 NORMAL：正常渠道创建，PINTUAN：拼团失败自动创建',
                             PRIMARY KEY (`id`) USING BTREE,
                             KEY `ES_INDEX_ID` (`id`) USING BTREE,
                             KEY `ES_INDEX_SN` (`sn`) USING BTREE,
                             KEY `ES_INDEX_ORDER_SN` (`order_sn`) USING BTREE,
                             KEY `ES_INDEX_REFUND_STATUS` (`refund_status`) USING BTREE,
                             KEY `ES_INDEX_CREATE_TIME` (`create_time`) USING BTREE,
                             KEY `ES_MEMBER_ID` (`member_id`) USING BTREE,
                             KEY `ES_SELLER_ID` (`seller_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='售后服务退款单表';

-- 交易表
DROP TABLE IF EXISTS `es_trade`;
CREATE TABLE `es_trade` (
                            `trade_id` bigint(20) NOT NULL COMMENT 'trade_id',
                            `trade_sn` varchar(50) DEFAULT NULL COMMENT '交易编号',
                            `member_id` bigint(20) DEFAULT NULL COMMENT '买家id',
                            `member_name` varchar(100) DEFAULT NULL COMMENT '买家用户名',
                            `payment_method_id` bigint(20) DEFAULT NULL COMMENT '支付方式id',
                            `payment_plugin_id` varchar(50) DEFAULT NULL COMMENT '支付插件id',
                            `payment_method_name` varchar(50) DEFAULT NULL COMMENT '支付方式名称',
                            `payment_type` varchar(20) DEFAULT NULL COMMENT '支付方式类型',
                            `total_price` decimal(20,2) DEFAULT NULL COMMENT '总价格',
                            `goods_price` decimal(20,2) DEFAULT NULL COMMENT '商品价格',
                            `freight_price` decimal(20,2) DEFAULT NULL COMMENT '运费',
                            `discount_price` decimal(20,2) DEFAULT NULL COMMENT '优惠的金额',
                            `consignee_id` bigint(20) DEFAULT NULL COMMENT '收货人id',
                            `consignee_name` varchar(255) DEFAULT NULL COMMENT '收货人姓名',
                            `consignee_country` varchar(50) DEFAULT NULL COMMENT '收货国家',
                            `consignee_country_id` bigint(20) DEFAULT NULL COMMENT '收货国家id',
                            `consignee_province` varchar(50) DEFAULT NULL COMMENT '收货省',
                            `consignee_province_id` bigint(20) DEFAULT NULL COMMENT '收货省id',
                            `consignee_city` varchar(50) DEFAULT NULL COMMENT '收货市',
                            `consignee_city_id` bigint(20) DEFAULT NULL COMMENT '收货市id',
                            `consignee_county` varchar(50) DEFAULT NULL COMMENT '收货区',
                            `consignee_county_id` bigint(20) DEFAULT NULL COMMENT '收货区id',
                            `consignee_town` varchar(50) DEFAULT NULL COMMENT '收货镇',
                            `consignee_town_id` bigint(20) DEFAULT NULL COMMENT '收货镇id',
                            `consignee_address` varchar(255) DEFAULT NULL COMMENT '收货详细地址',
                            `consignee_mobile` varchar(50) DEFAULT NULL COMMENT '收货人手机号',
                            `consignee_telephone` varchar(50) DEFAULT NULL COMMENT '收货人电话',
                            `create_time` bigint(20) DEFAULT NULL COMMENT '交易创建时间',
                            `order_json` longtext COMMENT '订单json(预留，7.0可能废弃)',
                            `trade_status` varchar(50) DEFAULT NULL COMMENT '订单状态',
                            `balance` decimal(20,2) DEFAULT '0.00' COMMENT '预存款抵扣金额',
                            PRIMARY KEY (`trade_id`) USING BTREE,
                            KEY `ind_trade_sn` (`trade_sn`) USING BTREE,
                            KEY `index_trade` (`trade_id`,`member_id`,`payment_method_id`,`payment_plugin_id`,`trade_status`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='交易表';

-- 交易记录表
DROP TABLE IF EXISTS `es_transaction_record`;
CREATE TABLE `es_transaction_record` (
                                         `record_id` bigint(20) NOT NULL COMMENT '主键ID',
                                         `order_sn` varchar(50) DEFAULT NULL COMMENT '订单编号',
                                         `goods_id` bigint(20) DEFAULT NULL COMMENT '商品ID',
                                         `goods_num` int(10) DEFAULT NULL COMMENT '商品数量',
                                         `rog_time` bigint(20) DEFAULT NULL COMMENT '确认收货时间',
                                         `uname` varchar(50) DEFAULT NULL COMMENT '用户名',
                                         `price` decimal(20,2) DEFAULT NULL COMMENT '交易价格',
                                         `member_id` bigint(20) DEFAULT NULL COMMENT '会员ID',
                                         `create_time` bigint(20) DEFAULT NULL COMMENT '订单创建时间',
                                         PRIMARY KEY (`record_id`) USING BTREE,
                                         KEY `index_goods_id` (`goods_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='交易记录表';

SET FOREIGN_KEY_CHECKS = 1;



